//
//  AddFile.m
//  MyBlock
//
//  Created by 黄世光 on 15/11/16.
//  Copyright © 2015年 SHG. All rights reserved.
//

#import "AddFile.h"

@implementation AddFile
-(void)addCount:(NSInteger)a other:(NSInteger)b completion:(void (^)(NSInteger c))completion{
    

    __block NSInteger A = a ;
    //GCD串行队列异步任务
    dispatch_queue_t p =dispatch_queue_create("add", DISPATCH_QUEUE_SERIAL);
    dispatch_async(p, ^{
        NSLog(@"%@",[NSThread currentThread]);
        NSInteger c = 0;
        while (A < b) {
            A++;
        }
        c = A + b;
        dispatch_async(dispatch_get_main_queue(), ^{
            completion(c);
        });
        c = A;
        NSLog(@"异步线程结果%ld",c);
    });
   
    
}
@end
